﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NetfractionHub.Network.Protocol;
using NetfractionHub.Network.Protocol.BASE.Factory;

namespace NetfractionHub.LocalMachine.BotCommands.Handler
{
    [CommandHandler("listconfiguration", TriggerAlias="listconfig")]
    public class ListConfiguration : CommandHandler
    {
        public override BotReturnStatus HandleCommandMessage(NetfractionHub.RemoteMachine.Node source, CommandMessage message)
        {
            if (source == null)
                return new BotReturnStatus(false);

            if (!Security.Permission.HasPermission(source.SecurityIdentity, typeof(Security.Permissions.ListConfigurationPermission)))
                return new BotReturnStatus(false, Security.Permission.GetDeniedString(typeof(Security.Permissions.ListConfigurationPermission)));

            return new BotReturnStatus(true, Settings.HubSettings.ListSettings());
        }
    }
}
